@extends('template.base')
@section('content')
 <script src="{{URL::to('js/jquery-1.10.2.js')}}"></script>
		<script>
		$(document).ready(function(){
		  $("#hide").click(function(){
		    $("#p").hide();
		  });
		  $("#show").click(function(){
		    $("#p").show();
		  });
		});
		</script>
		<div class="container-green" >
		<h2 class="text-center">ORDER ONLINE</h2>
				<div class="btn-group btn-group-justified" style="margin-bottom:20px">
						  <div class="btn-group">
						    <button type="button" class="btn btn-default active"><strong>Data Pesanan(Order)</strong></button>
						  </div>
						  <div class="btn-group">
						    <button type="button" class="btn btn-default" disabled><strong>Data Pemesan(Client)</strong></button>
						  </div>
				</div>
		<div class="row">
			<div class="col-lg-3">
			<label>Order :</label>
			<hr id="hr1" />
			<strong>Cetak Brosur</strong><br><br>
			<p align="center"><img id="img" src="{{URL::to('images/icon_marketting-kit.jpg')}}" /><br><br>
			<a data-toggle="modal" data-target="#gantiorder"><button class="btn btn-primary" style="width:125px">Ganti order</button></a></p>    
			</div>
			<div class="col-lg-9">
			<label>Data pesanan(Detail order):</label>
			<hr id="hr1" />

					<div align="left">
							{{Form::open(array(
								'url' => 'order/orderbrosur',
								'method' => 'POST',
								'files' => true
							))}}

				      		<div class="row">
      						<div class="col-lg-4 col-lg-offset-1">
				      		<label>Jenis cetak (Type) <font color="red">*</font></label>
				      		</div>
      						<div class="col-lg-6">
      						<table>
      						<td>
				            <select class="form-control"  name="jenis_cetak" id="jenis_cetak" style="width:250px;height:30px" required >
				            	<option value="" id="">Silahkan pilih</option>
				            	<option value="brochure" id="brochure">Brosur</option>
				            	<option value="envelope" id="envelope">Amplop</option>
				            	<option value="letterhead" id="letterhead">Kop surat</option>
				            	<option value="flayer" id="flayer">Flayer</option>
				            </select>
					        </td>
					        <td>
					        	  {{$errors->first('jenis_brosur')}}
					        </td>
					    	</table><br>
				            </div>
				      		</div>

				      		<div class="row">
      						<div class="col-lg-4 col-lg-offset-1">
				      		<label>Ukuran (Size) <font color="red">*</font></label>
				      		</div>
      						<div class="col-lg-6">
      						<table>
      						<td>
				            <select class="form-control"  name="brosur_size" id="brosur_size" style="width:250px;height:30px" required >
				            	<option value="">Silahkan pilih</option>
				            	@foreach($brosursize as $bsize)
				            		<option value="{{$bsize->size_brochure_size_id}}" id="brosur{{$bsize->size_brochure_size_id}}">{{$bsize->size_brochure_name}}</option>
				            	@endforeach
				            	@foreach($letterheadsize as $lsize)
				            		<option value="{{$lsize->size_letterhead_size_id}}" id="letterhead{{$lsize->size_letterhead_size_id}}">{{$lsize->size_letterhead_name}}</option>
				            	@endforeach
				            	@foreach($flayersize as $fsize)
				            		<option value="{{$fsize->size_flayer_size_id}}" id="flayer{{$fsize->size_flayer_size_id}}">{{$fsize->size_flayer_length.' x '.$fsize->size_flayer_width.' '.$fsize->size_flayer_unit}}</option>
				            	@endforeach
				            	@foreach($envelopesize as $esize)
				            		<option value="{{$esize->size_envelope_size_id}}" id="envelope{{$esize->size_envelope_size_id}}">{{$esize->size_envelope_length.' x '.$esize->size_envelope_width.' '.$esize->size_envelope_unit}}</option>
				            	@endforeach

				            </select>
				        	</td>
				        	<td>
				        		{{$errors->first('kualitas_brosur')}}
				        	</td>
				        </table>
				        	<br>
				            </div>
				      		</div>


				      		<div class="row">
      						<div class="col-lg-4 col-lg-offset-1">
				      		<label>Jenis kertas <font color="red">*</font></label>
				      		</div>
      						<div class="col-lg-6">
      						<table>
      						<td>
				            <select class="form-control"  name="jenis_kertas" id="jenis_kertas"  style="width:250px;height:30px" required>
				            	<option value="">Silahkan pilih</option>
				            	@foreach($brosurkertas as $bkertas)
				            		<option value="{{$bkertas->papertype_id}}" id="brosurkertas{{$bkertas->papertype_id}}">{{$bkertas->papertype_name}}</option>
				            	@endforeach
				            	@foreach($letterheadkertas as $lkertas)
				            		<option value="{{$lkertas->papertype_id}}" id="letterheadkertas{{$lkertas->papertype_id}}">{{$lkertas->papertype_name}}</option>
				            	@endforeach
				            	@foreach($flayerkertas as $fkertas)
				            		<option value="{{$fkertas->papertype_id}}" id="flayerkertas{{$fkertas->papertype_id}}">{{$fkertas->papertype_name}}</option>
				            	@endforeach
				            	@foreach($envelopekertas as $ekertas)
				            		<option value="{{$ekertas->papertype_id}}" id="envelopekertas{{$ekertas->papertype_id}}">{{$ekertas->papertype_name}}</option>
				            	@endforeach
				            </select>
				        	</td>
				        	<td>
				        		{{$errors->first('kualitas_brosur')}}
				        	</td>
				        </table>
				        	<br>
				            </div>
				      		</div>

				      		<div class="row">
      						<div class="col-lg-4 col-lg-offset-1">
				            <label>Warna <font color="red">*</font></label>
				            </div>
      						<div class="col-lg-7">
      						<?php
      								if(Input::Old('warna')<>""){
					            	$jk = Input::Old('warna');
					            	}else{
					            	$jk = Session::get('warna');
					            	}
      						?>
	      						<div class="row">
	      						<div class="col-lg-4 ">
								<input type="radio" name="warna" value="Warna" <?php if($jk=='Warna'){echo "checked";} ?> required> Ya (Warna)   </input>  
	      						</div>
	      						<div class="col-lg-5 ">
								<input type="radio" name="warna" value="Hitam putih" <?php if($jk=='Hitam putih'){echo "checked";} ?> required> Tidak (Hitam putih)</input>
					            </div>
					            </div>
				            </div>
				            </div>
				            <br>{{$errors->first('warna')}}



				      		<div class="row">
      						<div class="col-lg-4 col-lg-offset-1">
				      		<label>Halaman cetak (Qty)<font color="red">*</font></label>
				      		</div>
      						<div class="col-lg-6">
      						<table>
      						<td>
				            <select class="form-control"  name="qty_print_page" style="width:250px;height:30px" required >
				            	<option value="">Silahkan pilih</option>
				            	<option value="1/2">1/2</option>
                                      <option value="1">1</option>
                                      <option value="1 1/2">1 1/2</option>
                                      <option value="2">2</option>
				            </select>
				        	</td>
				        	<td>
				        		{{$errors->first('kualitas_brosur')}}
				        	</td>
				        </table>
				        	<br>
				            </div>
				      		</div>

				      		<div class="row">
      						<div class="col-lg-4 col-lg-offset-1">
				      		<label>Design (Referensi / Sendiri)</label><br>
				      		(Format *ai, *psd, *jpg, *png, *cdr, max 5MB)
				      		</div>
      						<div class="col-lg-7">
				            <input type="file" class="form-control" id="i_file" name="design_brosur" style="width:250px;height:30px" />
				            <br>
				            </div>
				      		</div>

				      		<div class="row">
      						<div class="col-lg-4 col-lg-offset-1">
				      		<label>Jumlah order <font color="red">*</font></label>
				      		</div>
      						<div class="col-lg-6">
      							<div class="row">
	      						<div class="col-lg-4 ">
								<input class="form-control" type="text" name="jumlah_order" style="width:110px;height:30px" required ></input>  
	      						</div>
	      						<div class="col-lg-4 ">
								 <select  class="form-control"  name="brochure_unit" style="width:80px;height:30px">
                                        <option value="Rim">Rim</option>
                                        <option value="Pcs">Pcs</option>
                                      </select>
					            </div>
					            </div>
				            </div>
				      		</div>
				      		<br>


<script type="text/javascript">
    $("#jenis_cetak").change(function() {
          if ($(this).find("option:selected").attr("id") == "") {
          	$("#jenis_kertas").val('');
          	$("#brosur_size").val('');
               <?php foreach($brosursize as $bsize){ ?>
                $("#brosur{{$bsize->size_brochure_size_id}}").hide();
          	<?php }

            foreach($letterheadsize as $lsize){ ?>
                $("#letterhead{{$lsize->size_letterhead_size_id}}").hide();
            <?php } 

            foreach($envelopesize as $esize){ ?>
                $("#envelope{{$esize->size_envelope_size_id}}").hide();
            <?php } 

            foreach($flayersize as $fsize){ ?>
                $("#flayer{{$fsize->size_flayer_size_id}}").hide();
            <?php }


            foreach($brosurkertas as $bkertas){ ?>
                $("#brosurkertas{{$bkertas->papertype_id}}").hide();
          	<?php }

            foreach($letterheadkertas as $lkertas){ ?>
                $("#letterheadkertas{{$lkertas->papertype_id}}").hide();
            <?php } 

            foreach($envelopekertas as $ekertas){ ?>
                $("#envelopekertas{{$ekertas->papertype_id}}").hide();
            <?php } 

            foreach($flayerkertas as $fkertas){ ?>
                $("#flayerkertas{{$fkertas->papertype_id}}").hide();
            <?php } ?>


          } else if ($(this).find("option:selected").attr("id") == "brochure") {
			$("#jenis_kertas").val('');
          	$("#brosur_size").val('');
          	<?php foreach($brosursize as $bsize){ ?>
                $("#brosur{{$bsize->size_brochure_size_id}}").show();
          	<?php }

            foreach($letterheadsize as $lsize){ ?>
                $("#letterhead{{$lsize->size_letterhead_size_id}}").hide();
            <?php } 

            foreach($envelopesize as $esize){ ?>
                $("#envelope{{$esize->size_envelope_size_id}}").hide();
            <?php } 

            foreach($flayersize as $fsize){ ?>
                $("#flayer{{$fsize->size_flayer_size_id}}").hide();
            <?php } 


            foreach($brosurkertas as $bkertas){ ?>
                $("#brosurkertas{{$bkertas->papertype_id}}").show();
          	<?php }

            foreach($letterheadkertas as $lkertas){ ?>
                $("#letterheadkertas{{$lkertas->papertype_id}}").hide();
            <?php } 

            foreach($envelopekertas as $ekertas){ ?>
                $("#envelopekertas{{$ekertas->papertype_id}}").hide();
            <?php } 

            foreach($flayerkertas as $fkertas){ ?>
                $("#flayerkertas{{$fkertas->papertype_id}}").hide();
            <?php } ?>



          } else if ($(this).find("option:selected").attr("id") == "letterhead") {
            $("#jenis_kertas").val('');
          	$("#brosur_size").val('');
             <?php foreach($brosursize as $bsize){ ?>
                $("#brosur{{$bsize->size_brochure_size_id}}").hide();
          	<?php }

            foreach($letterheadsize as $lsize){ ?>
                $("#letterhead{{$lsize->size_letterhead_size_id}}").show();
            <?php } 

            foreach($envelopesize as $esize){ ?>
                $("#envelope{{$esize->size_envelope_size_id}}").hide();
            <?php } 

            foreach($flayersize as $fsize){ ?>
                $("#flayer{{$fsize->size_flayer_size_id}}").hide();
            <?php } 


            foreach($brosurkertas as $bkertas){ ?>
                $("#brosurkertas{{$bkertas->papertype_id}}").hide();
          	<?php }

            foreach($letterheadkertas as $lkertas){ ?>
                $("#letterheadkertas{{$lkertas->papertype_id}}").show();
            <?php } 

            foreach($envelopekertas as $ekertas){ ?>
                $("#envelopekertas{{$ekertas->papertype_id}}").hide();
            <?php } 

            foreach($flayerkertas as $fkertas){ ?>
                $("#flayerkertas{{$fkertas->papertype_id}}").hide();
            <?php } ?>



          } else if ($(this).find("option:selected").attr("id") == "envelope") {
            $("#jenis_kertas").val('');
          	$("#brosur_size").val('');
             <?php foreach($brosursize as $bsize){ ?>
                $("#brosur{{$bsize->size_brochure_size_id}}").hide();
          	<?php }

            foreach($letterheadsize as $lsize){ ?>
                $("#letterhead{{$lsize->size_letterhead_size_id}}").hide();
            <?php } 

            foreach($envelopesize as $esize){ ?>
                $("#envelope{{$esize->size_envelope_size_id}}").show();
            <?php } 

            foreach($flayersize as $fsize){ ?>
                $("#flayer{{$fsize->size_flayer_size_id}}").hide();
            <?php } 


            foreach($brosurkertas as $bkertas){ ?>
                $("#brosurkertas{{$bkertas->papertype_id}}").hide();
          	<?php }

            foreach($letterheadkertas as $lkertas){ ?>
                $("#letterheadkertas{{$lkertas->papertype_id}}").hide();
            <?php } 

            foreach($envelopekertas as $ekertas){ ?>
                $("#envelopekertas{{$ekertas->papertype_id}}").show();
            <?php } 

            foreach($flayerkertas as $fkertas){ ?>
                $("#flayerkertas{{$fkertas->papertype_id}}").hide();
            <?php } ?>



          } else if ($(this).find("option:selected").attr("id") == "flayer") {
             $("#jenis_kertas").val('');
          	$("#brosur_size").val('');
              <?php foreach($brosursize as $bsize){ ?>
                $("#brosur{{$bsize->size_brochure_size_id}}").hide();
          	<?php }

            foreach($letterheadsize as $lsize){ ?>
                $("#letterhead{{$lsize->size_letterhead_size_id}}").hide();
            <?php } 

            foreach($envelopesize as $esize){ ?>
                $("#envelope{{$esize->size_envelope_size_id}}").hide();
            <?php } 

            foreach($flayersize as $fsize){ ?>
                $("#flayer{{$fsize->size_flayer_size_id}}").show();
            <?php } 


            foreach($brosurkertas as $bkertas){ ?>
                $("#brosurkertas{{$bkertas->papertype_id}}").hide();
          	<?php }

            foreach($letterheadkertas as $lkertas){ ?>
                $("#letterheadkertas{{$lkertas->papertype_id}}").hide();
            <?php } 

            foreach($envelopekertas as $ekertas){ ?>
                $("#envelopekertas{{$ekertas->papertype_id}}").hide();
            <?php } 

            foreach($flayerkertas as $fkertas){ ?>
                $("#flayerkertas{{$fkertas->papertype_id}}").show();
            <?php } ?>
          }
    });
</script>
				    </div>
			<hr id="hr1" />
			<font color="red">* Data tidak boleh kosong</font><br><br>

			<p style="margin-bottom:55px"><button type="submit" id="i_submit" class="btn btn-success pull-right" style="width:125px">Lanjutkan</button>{{form::close()}}<a href="{{URL::to('/')}}"><button class="btn btn-danger pull-right" style="width:125px; margin-right:5px">Kembali</button></a></p>
			
			

			</div>
	</div>
	</div>



	<div class="modal fade" id="gantiorder" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
                <div class="modal-dialog" style="width:80%">
                  <div class="modal-content">
                    <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
 
                    <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:10px">Ganti order</label></h4>
                    </div>
                    <div class="container" style="width:100%">
                    	<br>
					      <div class="col-sm-2">
					        <div class="panel panel-success">
					          <div class="panel-heading">
					            <h2 class="panel-title" align="center">Brosur</h2>
					          </div>
					          <div class="panel-body">
					          <p align="center"><img id="img" src="{{URL::to('images/icon_marketting-kit.jpg')}}" /><br><br>
					           <a href="{{URL::to('order/orderbrosur')}}"><button class="btn btn-primary" style="width:100px">Pesan</button></a></p>  
					          </div> 
					        </div>
					      </div>

					      <div class="col-sm-2">
					        <div class="panel panel-success">
					          <div class="panel-heading">
					            <h2 class="panel-title" align="center">ID Card</h2>
					          </div>
					          <div class="panel-body">
					          <p align="center"><img id="img" src="{{URL::to('images/icon_kartu.jpg')}}" /></br></br>
					          <a href="{{URL::to('order/orderidcard')}}"><button class="btn btn-primary" style="width:100px">Pesan</button></a></p>     
					          </div>                
					        </div>
					      </div>

					      <div class="col-sm-2">
					        <div class="panel panel-success">
					          <div class="panel-heading">
					            <h2 class="panel-title" align="center">Packaging</h2>
					          </div>
					          <div class="panel-body">
					          <p align="center"><img id="img" src="{{URL::to('images/icon_packaging.jpg')}}" /></br></br>
					           <a href="{{URL::to('order/orderpackaging')}}"><button class="btn btn-primary" style="width:100px">Pesan</button></a></p>
					          </div>                
					        </div>
					      </div>

					      <div class="col-sm-2">
					        <div class="panel panel-success">
					          <div class="panel-heading">
					            <h2 class="panel-title" align="center">Kaos</h2>
					          </div>
					          <div class="panel-body">
					          <p align="center"><img id="img" src="{{URL::to('images/tshirt_product.png')}}" /></br></br>
					          <a href="{{URL::to('order/ordertshirt')}}"><button class="btn btn-primary" style="width:100px">Pesan</button></a></p>
					          </div>                
					        </div>
					      </div>

					      <div class="col-sm-2">
					        <div class="panel panel-success">
					          <div class="panel-heading">
					            <h2 class="panel-title" align="center">Nota</h2>
					          </div>
					          <div class="panel-body">
					          <p align="center"><img id="img" src="{{URL::to('images/nota_product.png')}}" /></br></br>
					          <a href="{{URL::to('order/ordernota')}}"><button class="btn btn-primary" style="width:100px">Pesan</button></a></p>
					          </div>                
					        </div>
					      </div>
					</div> 
				</div> 
                 </div>
</div>
	<script type="text/javascript">

		$('#i_submit').click( function() {
		    //check whether browser fully supports all File API
		    if (window.File && window.FileReader && window.FileList && window.Blob)
		    {
		        //get the file size and file type from file input field
		        var fsize = $('#i_file')[0].files[0].size;
		       
		        if(fsize>5097152) //do something if file size more than 1 mb (1048576)
		        {
		            setTimeout(function(){
				       alert("File desain terlalu besar\nSilahkan ganti!");
				    }, 1000);
		           	return false; 
		        }
		    }else{
		        alert("Please upgrade your browser, because your current browser lacks some new features we need!");
		    }
		});


	</script>
@stop
@stop